<?php

use Illuminate\Http\Request;
//use Illuminate\Contracts\Routing\Registrar as Router;
use Illuminate\Support\Facades\Route;

Route::group(['middleware' => 'auth:api'], function () {
    //获取当前用户信息
    Route::get('/user/info', function(Request $request){
        return response()->json($request->user(), 200);
    });

    //plugin nav
    Route::get('/plugin/nav/list', 'PluginNavController@infos');
    Route::post('/plugin/nav/save', 'PluginNavController@save');
    Route::post('/plugin/nav/delete', 'PluginNavController@delete');
    Route::post('/plugin/nav/pin', 'PluginNavController@pin');

    //plugin list
    Route::group(['prefix' => 'plugin/lists'], function () {
        Route::get('/', 'API\PluginListController@infos');
        Route::post('/', 'API\PluginListController@create');
        Route::put('/', 'API\PluginListController@updateAll');
        Route::put('/{list}', 'API\PluginListController@update');
        Route::delete('/{list}', 'API\PluginListController@delete');
    });
//    Route::group(['prefix' => 'plugin/listitems'], function () {
//        Route::patch('/{item}/check', 'API\PluginListController@update');
//        Route::delete('/{item}/reset', 'API\PluginListController@update');
//    });

});

//Route::redirect('/token', '/', 301);
Route::post('/token', 'UserController@authenticate');
